import { useState, useEffect } from 'react';
import { StyleSheet, Text, View, Button } from 'react-native';
import { useFocusEffect } from '@react-navigation/native';

const Home = ({navigation}) => {
    const [num, setNum] = useState(0);
    useFocusEffect(()=>{
        console.log(66)
    })
    const goDetail = () => {
        navigation.navigate('detail',{userName: '张三'})
    }
    return (
        <View style={{flex: 1}}>
            <Text style={{fontSize:30}}>
                {num}
            </Text>
            <Button 
                title='点击+1'
                onPress={()=>setNum(num+1)}
            />
            <Button 
                title='to detail'
                onPress={goDetail}
            />
        </View>
    )
}
export default Home